// /////////////////////////////////////////////////////////////////////////////
//
// Name:            asSoundManager.cpp
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Binds the SoundManager class to AngelScript
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

// Include files
#include "asSoundManager.h"

#ifdef __COMPILE_WITH_ANGELSCRIPT__
#ifdef __COMPILE_WITH_SFML_AUDIO__

#include "../ScriptHelper.h"

#include "../../sound/SoundManager.h"


//! Binds the SoundManager class to AngelScript.
void bindSoundManager(asIScriptEngine *engine)
{
    // Forward declarations.
    int r;

    // Bind SoundManager class.
    r = engine->RegisterObjectType("SoundManager", sizeof(SoundManager), asOBJ_REF); assert(r >= 0);

    // Set SoundManager behaviour.
    r = engine->RegisterObjectBehaviour("SoundManager", asBEHAVE_ADDREF, "void f()",
                                        asMETHOD(SoundManager, grab), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectBehaviour("SoundManager", asBEHAVE_RELEASE, "void f()",
                                        asMETHOD(SoundManager, drop), asCALL_THISCALL); assert(r >= 0);

    // Bind SoundManager class functions.
    r = engine->RegisterObjectMethod("SoundManager", "void init()",
                                     asMETHOD(SoundManager, init), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("SoundManager", "void clear()",
                                     asMETHOD(SoundManager, clear), asCALL_THISCALL); assert(r >= 0);

    r = engine->RegisterObjectMethod("SoundManager", "f32 getGlobalVolume()",
                                     asMETHOD(SoundManager, getGlobalVolume), asCALL_THISCALL); assert(r >= 0);

    r = engine->RegisterObjectMethod("SoundManager", "bool loadSoundBuffer(const string &in)",
                                     asMETHOD(SoundManager, loadSoundBuffer), asCALL_THISCALL); assert(r >= 0);

    r = engine->RegisterObjectMethod("SoundManager", "void removeSoundBuffers()",
                                     asMETHOD(SoundManager, removeSoundBuffers), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("SoundManager", "bool removeSoundBuffer(const string &in)",
                                     asMETHOD(SoundManager, removeSoundBuffer), asCALL_THISCALL); assert(r >= 0);

    r = engine->RegisterObjectMethod("SoundManager", "void setGlobalVolume(f32)",
                                     asMETHOD(SoundManager, setGlobalVolume), asCALL_THISCALL); assert(r >= 0);
}

#endif // __COMPILE_WITH_SFML_AUDIO__
#endif // __COMPILE_WITH_ANGELSCRIPT__

// End of File
